home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / MSORES.DLL / 226 / 656 < prev    next >
Extensible Markup Language  |  2006-10-26  |  16KB  |  331 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. ***************************************************************************
  4.     dlcxsd2xsf.xslt
  5.     Copyright (c) 2004 Microsoft Corporation 
  6.     Transform that creates a manifest from an XSD.
  7. *************************************************************************** -->
  8. <xsl:stylesheet
  9.     version="1.0"
  10.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  11.     xmlns:ct="http://schemas.microsoft.com/office/2006/metadata/contentType"
  12.     xmlns:sts="http://schemas.microsoft.com/sharepoint/soap/"
  13.     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  14.     <xsl:output method="xml" encoding="UTF-8" indent="yes" />
  15.     <!-- Localized Strings -->
  16.     <xsl:param name="localizedPropertyPanelName">Document Information Panel</xsl:param>
  17.     <xsl:param name="localizedSingleUserErrorMsg">You can enter only one value.</xsl:param>
  18.     <!-- Left as the default until I find out that typenamespace can change -->
  19.     <xsl:param name="typeNSUri">http://schemas.microsoft.com/office/2006/documentManagement/types</xsl:param>
  20.     <xsl:param name="dcNSUri">http://purl.org/dc/elements/1.1/</xsl:param>
  21.     <xsl:param name="dctermsNSUri">http://purl.org/dc/terms/</xsl:param>
  22.     <xsl:param name="dcmitypeNSUri">http://purl.org/dc/dcmitype/</xsl:param>
  23.     <xsl:param name="xmlNSUri">http://www.w3.org/XML/1998/namespace</xsl:param>
  24.     <xsl:param name="rootNSUri">http://schemas.microsoft.com/office/2006/metadata/propertiesRoot</xsl:param>
  25.     <!-- Determines whether or not this XSF includes template and sampledata xml. -->
  26.     <xsl:param name="fIncludeTemplate">false</xsl:param>
  27.     <xsl:param name="fDomain">false</xsl:param>
  28.     <!-- View locale -->
  29.     <xsl:param name="viewLcid">1033</xsl:param>
  30.     <!-- Properties Root namespace -->
  31.     <xsl:variable name="prNSUri">http://schemas.microsoft.com/office/2006/metadata/propertiesRoot</xsl:variable>
  32.     <!-- Core properties namespace -->
  33.     <xsl:variable name="coreNSUri">http://schemas.openxmlformats.org/package/2006/metadata/core-properties</xsl:variable>
  34.     <xsl:variable name="corePrefix">core</xsl:variable>
  35.     <xsl:variable name="baseXPath">pr:properties/p:properties/documentManagement/</xsl:variable>
  36.     <xsl:variable name="baseXPathCore">pr:properties/<xsl:value-of select="$corePrefix" />:coreProperties/</xsl:variable>
  37.     <xsl:template match="/ct:contentTypeSchema | /xsd:schema">
  38.         <xsl:comment>This file is automatically created by Microsoft Office.</xsl:comment>
  39.         <xsf:xDocumentClass 
  40.                     solutionFormatVersion="2.0.0.0"
  41.                     solutionVersion="1.0.0.1"
  42.                     productVersion="12.0.0"
  43.                     xmlns:xsf="http://schemas.microsoft.com/office/infopath/2003/solutionDefinition" 
  44.                     xmlns:xsf2='http://schemas.microsoft.com/office/infopath/2006/solutionDefinition/extensions'
  45.                     xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
  46.                     xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" 
  47.                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  48.                     xmlns:xdUtil="http://schemas.microsoft.com/office/infopath/2003/xslt/Util" 
  49.                     xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" 
  50.                     xmlns:xdMath="http://schemas.microsoft.com/office/infopath/2003/xslt/Math" 
  51.                     xmlns:xdDate="http://schemas.microsoft.com/office/infopath/2003/xslt/Date" 
  52.                     xmlns:sts="http://schemas.microsoft.com/sharepoint/soap/" 
  53.                     xmlns:ma="http://schemas.microsoft.com/office/2006/metadata/properties/metaAttributes"
  54.                     xmlns:dms="http://schemas.microsoft.com/office/2006/documentManagement/types"
  55.                     xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties"
  56.                     xmlns:s0="http://schemas.microsoft.com/sharepoint/soap/directory/" 
  57.                     xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" 
  58.                     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
  59.                     xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
  60.                     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
  61.                     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  62.                     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
  63.                     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
  64.             <xsl:variable name="nsDecls" select="xsd:schema[@ma:root='true']/namespace::*[local-name() != 'xml']" />
  65.             <xsl:variable name="schemas" select="/ct:contentTypeSchema/xsd:schema | /xsd:schema" />
  66.             <xsl:variable name="urlFields" select="xsd:schema[not(@ma:root='true')]/xsd:element[
  67.                                             not(@ma:hidden='true') and 
  68.                                             not(@ma:readOnly='true') and 
  69.                                             xsd:complexType/xsd:complexContent/*/@base='dms:URL']" />
  70.             <xsl:variable name="userFields" select="xsd:schema[not(@ma:root='true')]/xsd:element[
  71.                                             not(@ma:hidden='true') and 
  72.                                             not(@ma:readOnly='true') and 
  73.                                             xsd:complexType/xsd:complexContent/*/@base='dms:User']" />
  74.             <xsl:variable name="businessDataFields" select="xsd:schema[not(@ma:root='true')]/xsd:element[
  75.                                             not(@ma:hidden='true') and 
  76.                                             not(@ma:readOnly='true') and 
  77.                                             xsd:complexType/xsd:simpleContent/*/@base='dms:BusinessDataPrimaryField']" />
  78.             <!-- namespace declarations -->
  79.             <xsl:for-each select="$nsDecls">
  80.                 <xsl:attribute name="{local-name()}:_" namespace="{.}" />
  81.             </xsl:for-each>
  82.             <xsl:attribute name="{$corePrefix}:_" namespace="{$coreNSUri}" />
  83.             <xsl:attribute name="pr:_" namespace="{$prNSUri}" />
  84.             <xsl:attribute name="dc:_" namespace="{$dcNSUri}" />
  85.             <!-- trust settings -->
  86.             <xsl:attribute name="trustSetting">automatic</xsl:attribute> 
  87.             <xsl:choose>
  88.                 <xsl:when test="$fDomain = 'false'">
  89.                     <xsl:attribute name="trustLevel">restricted</xsl:attribute>
  90.                 </xsl:when>
  91.                 <xsl:otherwise>
  92.                     <xsl:attribute name="trustLevel">domain</xsl:attribute>
  93.                 </xsl:otherwise>
  94.             </xsl:choose>
  95.             <xsf:package>
  96.                 <xsf:files>
  97.                     <xsl:for-each select="$schemas">
  98.                         <xsf:file>
  99.                             <xsl:attribute name="name">
  100.                                 <xsl:text>propertySchema</xsl:text><xsl:value-of select="position() - 1" /><xsl:text>.xsd</xsl:text>
  101.                             </xsl:attribute>
  102.                             <xsf:fileProperties>
  103.                                 <xsf:property name="editability" type="string" value="none" />
  104.                                 <xsf:property name="namespace" type="string" >
  105.                                     <xsl:attribute name="value"><xsl:value-of select="@targetNamespace"/></xsl:attribute>
  106.                                 </xsf:property>
  107.                                 <xsl:if test="@ma:root='true' or @targetNamespace = $coreNSUri">
  108.                                     <xsf:property name="rootElement" type="string" value="properties" />
  109.                                 </xsl:if>
  110.                             </xsf:fileProperties>
  111.                         </xsf:file>
  112.                     </xsl:for-each>
  113.                     <xsf:file name="dc.xsd" >
  114.                         <xsf:fileProperties>
  115.                             <xsf:property name="namespace" type="string" >
  116.                                 <xsl:attribute name="value"><xsl:value-of select="$dcNSUri"/></xsl:attribute>
  117.                             </xsf:property>
  118.                             <xsf:property name="editability" type="string" value="none" />
  119.                         </xsf:fileProperties>
  120.                     </xsf:file>
  121.                     <xsf:file name="dcterms.xsd" >
  122.                         <xsf:fileProperties>
  123.                             <xsf:property name="namespace" type="string" >
  124.                                 <xsl:attribute name="value"><xsl:value-of select="$dctermsNSUri"/></xsl:attribute>
  125.                             </xsf:property>
  126.                             <xsf:property name="editability" type="string" value="none" />
  127.                         </xsf:fileProperties>
  128.                     </xsf:file>
  129.                     <xsf:file name="dcmitype.xsd" >
  130.                         <xsf:fileProperties>
  131.                             <xsf:property name="namespace" type="string" >
  132.                                 <xsl:attribute name="value"><xsl:value-of select="$dcmitypeNSUri"/></xsl:attribute>
  133.                             </xsf:property>
  134.                             <xsf:property name="editability" type="string" value="none" />
  135.                         </xsf:fileProperties>
  136.                     </xsf:file>
  137.                     <xsf:file name="xml.xsd" >
  138.                         <xsf:fileProperties>
  139.                             <xsf:property name="namespace" type="string" >
  140.                                 <xsl:attribute name="value"><xsl:value-of select="$xmlNSUri"/></xsl:attribute>
  141.                             </xsf:property>
  142.                             <xsf:property name="editability" type="string" value="none" />
  143.                         </xsf:fileProperties>
  144.                     </xsf:file>
  145.                     <xsf:file name="typeSchema.xsd" >
  146.                         <xsf:fileProperties>
  147.                             <xsf:property name="namespace" type="string" >
  148.                                 <xsl:attribute name="value"><xsl:value-of select="$typeNSUri"/></xsl:attribute>
  149.                             </xsf:property>
  150.                             <xsf:property name="editability" type="string" value="none" />
  151.                         </xsf:fileProperties>
  152.                     </xsf:file>
  153.                     <xsf:file name="rootSchema.xsd" >
  154.                         <xsf:fileProperties>
  155.                             <xsf:property name="namespace" type="string" >
  156.                                 <xsl:attribute name="value"><xsl:value-of select="$rootNSUri"/></xsl:attribute>
  157.                             </xsf:property>
  158.                             <xsf:property name="editability" type="string" value="none" />
  159.                             <xsf:property name="rootElement" type="string" value="properties" />
  160.                         </xsf:fileProperties>
  161.                     </xsf:file>
  162.                     <xsf:file name="view1.xsl" >
  163.                         <xsf:fileProperties>
  164.                             <xsf:property name="lang" type="string">
  165.                                 <xsl:attribute name="value"><xsl:value-of select="$viewLcid" /></xsl:attribute>
  166.                             </xsf:property>
  167.                         </xsf:fileProperties>
  168.                     </xsf:file>
  169.                     <xsl:if test="count($businessDataFields) > 0">
  170.                         <xsf:file name="script.js">
  171.                             <xsf:fileProperties>
  172.                                 <xsf:property name="scriptType" type="string" value="userEvents"></xsf:property>
  173.                             </xsf:fileProperties>
  174.                         </xsf:file>
  175.                         <xsf:file name="bizdata.gif">
  176.                             <xsf:fileProperties>
  177.                                 <xsf:property name="fileType" type="string" value="resource"></xsf:property>
  178.                             </xsf:fileProperties>
  179.                         </xsf:file>
  180.                     </xsl:if>
  181.                     <xsl:if test="$fIncludeTemplate='true'">
  182.                         <xsf:file name="template.xml"></xsf:file>
  183.                         <xsf:file name="sampledata.xml">
  184.                             <xsf:fileProperties>
  185.                                 <xsf:property name="fileType" type="string" value="sampleData"></xsf:property>
  186.                             </xsf:fileProperties>
  187.                         </xsf:file>
  188.                     </xsl:if>
  189.                 </xsf:files>
  190.             </xsf:package>
  191.             <xsf:views default="view1">
  192.                 <xsf:view name="view1" caption="Default View" showMenuItem="yes">
  193.                     <xsl:if test="count($businessDataFields) > 0">
  194.                         <xsf:unboundControls>
  195.                             <xsl:for-each select="//xsd:extension[@base='dms:BusinessDataPrimaryField']">
  196.                                 <xsf:button>
  197.                                     <xsl:attribute name="name">
  198.                                         <xsl:value-of select="../../../@name" /><xsl:text>_Resolver</xsl:text>
  199.                                     </xsl:attribute>
  200.                                 </xsf:button>
  201.                             </xsl:for-each>
  202.                         </xsf:unboundControls>
  203.                     </xsl:if>
  204.                     <xsf:mainpane transform="view1.xsl" />
  205.                     <xsf:editing>
  206.                         <xsl:for-each select ="$businessDataFields">    
  207.                             <xsf:xmlToEdit name="{@name}" item="{$baseXPath}{local-name($nsDecls[. = current()/../@targetNamespace])}:{@name}">
  208.                                 <xsf:editWith maxLength="1000" component="xField" proofing="no"></xsf:editWith>
  209.                             </xsf:xmlToEdit>
  210.                         </xsl:for-each>
  211.                         <xsl:for-each select ="xsd:schema[not(@ma:root='true')]/xsd:element[
  212.                                                 not(@ma:hidden='true') and 
  213.                                                 not(@ma:readOnly='true') and 
  214.                                                 xsd:simpleType/xsd:restriction/@base='dms:Note']">
  215.                             <xsf:xmlToEdit name="{@name}" item="{$baseXPath}{local-name($nsDecls[. = current()/../@targetNamespace])}:{@name}">
  216.                                 <xsf:editWith type="plainMultiline" component="xField"></xsf:editWith>
  217.                             </xsf:xmlToEdit>
  218.                         </xsl:for-each>
  219.                         <xsl:if test="@targetNamespace=$coreNSUri or xsd:schema[@targetNamespace=$coreNSUri]">
  220.                             <xsf:xmlToEdit name="description" item="{$baseXPathCore}dc:description">
  221.                                 <xsf:editWith type="plainMultiline" component="xField"></xsf:editWith>
  222.                             </xsf:xmlToEdit>
  223.                         </xsl:if>
  224.                     </xsf:editing>
  225.                 </xsf:view>
  226.             </xsf:views>
  227.             <xsf:documentSchemas>
  228.                 <xsl:for-each select="$schemas">
  229.                     <xsf:documentSchema>
  230.                         <xsl:attribute name="rootSchema">no</xsl:attribute>
  231.                         <xsl:attribute name="location">
  232.                             <xsl:value-of select="@targetNamespace" />
  233.                             <xsl:text> propertySchema</xsl:text><xsl:value-of select="position() - 1" /><xsl:text>.xsd</xsl:text>
  234.                         </xsl:attribute>
  235.                     </xsf:documentSchema>
  236.                 </xsl:for-each>
  237.                 <xsf:documentSchema rootSchema="no">
  238.                     <xsl:attribute name="location">
  239.                         <xsl:value-of select="$dcNSUri" />
  240.                         <xsl:text> dc.xsd</xsl:text>
  241.                     </xsl:attribute>
  242.                 </xsf:documentSchema>
  243.                 <xsf:documentSchema rootSchema="no">
  244.                     <xsl:attribute name="location">
  245.                         <xsl:value-of select="$dctermsNSUri" />
  246.                         <xsl:text> dcterms.xsd</xsl:text>
  247.                     </xsl:attribute>
  248.                 </xsf:documentSchema>
  249.                 <xsf:documentSchema rootSchema="no">
  250.                     <xsl:attribute name="location">
  251.                         <xsl:value-of select="$dcmitypeNSUri" />
  252.                         <xsl:text> dcmitype.xsd</xsl:text>
  253.                     </xsl:attribute>
  254.                 </xsf:documentSchema>
  255.                 <xsf:documentSchema rootSchema="no">
  256.                     <xsl:attribute name="location">
  257.                         <xsl:value-of select="$xmlNSUri" />
  258.                         <xsl:text> xml.xsd</xsl:text>
  259.                     </xsl:attribute>
  260.                 </xsf:documentSchema>
  261.                 <xsf:documentSchema rootSchema="no">
  262.                     <xsl:attribute name="location">
  263.                         <xsl:value-of select="$typeNSUri" />
  264.                         <xsl:text> typeSchema.xsd</xsl:text>
  265.                     </xsl:attribute>
  266.                 </xsf:documentSchema>
  267.                 <xsf:documentSchema rootSchema="yes">
  268.                     <xsl:attribute name="location">
  269.                         <xsl:value-of select="$rootNSUri" />
  270.                         <xsl:text> rootSchema.xsd</xsl:text>
  271.                     </xsl:attribute>
  272.                 </xsf:documentSchema>
  273.             </xsf:documentSchemas>
  274.             <xsl:if test="$fIncludeTemplate='true'">
  275.                 <xsf:fileNew>
  276.                     <xsf:initialXmlDocument caption="{$localizedPropertyPanelName}" href="template.xml"></xsf:initialXmlDocument>
  277.                 </xsf:fileNew>
  278.             </xsl:if>
  279.             <xsf:ruleSets>
  280.                 <xsl:for-each select ="$urlFields">
  281.                     <xsf:ruleSet name="ruleSet_URL_{@name}">
  282.                         <xsf:rule caption="UNC" condition="starts-with(., '\\')">
  283.                             <xsf:assignmentAction targetField="." expression="concat('file://', .)"></xsf:assignmentAction>
  284.                         </xsf:rule>
  285.                     </xsf:ruleSet>
  286.                 </xsl:for-each>
  287.             </xsf:ruleSets>
  288.             <xsf:domEventHandlers>
  289.                 <xsl:for-each select ="$urlFields">
  290.                     <xsl:variable name="nsPrefix" select="local-name($nsDecls[. = current()/../@targetNamespace])" />
  291.                     <xsf:domEventHandler match="/{$baseXPath}{$nsPrefix}:{@name}/{$nsPrefix}:Url">
  292.                         <xsf:ruleSetAction ruleSet="ruleSet_URL_{@name}"></xsf:ruleSetAction>
  293.                     </xsf:domEventHandler>
  294.                 </xsl:for-each>
  295.                 <xsl:for-each select ="$businessDataFields">
  296.                     <xsl:variable name="nsPrefix" select="local-name($nsDecls[. = current()/../@targetNamespace])" />
  297.                     <xsf:domEventHandler match="/{$baseXPath}{$nsPrefix}:{@name}" handlerObject="{@name}_Validator">
  298.                     </xsf:domEventHandler>
  299.                 </xsl:for-each>
  300.             </xsf:domEventHandlers>
  301.             <xsf:customValidation>
  302.                 <xsl:for-each select="$userFields">
  303.                     <xsl:variable name="nsPrefix" select="local-name($nsDecls[. = current()/../@targetNamespace])" />
  304.                     <xsf:errorCondition match="{$baseXPath}{$nsPrefix}:{@name}" expressionContext="." expression="count({$nsPrefix}:UserInfo) > 1">
  305.                         <xsf:errorMessage type="modeless" shortMessage="{$localizedSingleUserErrorMsg}">
  306.                             <xsl:value-of select="$localizedSingleUserErrorMsg" />
  307.                         </xsf:errorMessage>
  308.                     </xsf:errorCondition>
  309.                 </xsl:for-each>
  310.             </xsf:customValidation>
  311.             <xsf:applicationParameters application="InfoPath Design Mode">
  312.             </xsf:applicationParameters>
  313.             <xsf:dataObjects>
  314.             </xsf:dataObjects>
  315.             <xsf:extensions>
  316.                 <xsf:extension name="SolutionDefinitionExtensions">
  317.                     <xsf2:solutionDefinition runtimeCompatibility="client">
  318.                         <xsf2:dataConnections />
  319.                         <xsf2:offline openIfQueryFails="yes" cacheQueries="yes"></xsf2:offline>
  320.                     </xsf2:solutionDefinition>
  321.                 </xsf:extension>
  322.             </xsf:extensions>
  323.             <xsl:if test="count($businessDataFields) > 0">
  324.                 <xsf:scripts language="jscript">
  325.                     <xsf:script src="script.js"></xsf:script>
  326.                 </xsf:scripts>
  327.             </xsl:if>
  328.         </xsf:xDocumentClass>
  329.     </xsl:template>
  330. </xsl:stylesheet>
  331.